package com.example.demo.vo

import com.example.demo.dbmodels.TProductType
import io.swagger.annotations.ApiModelProperty

class ProductTypeVo {

    @ApiModelProperty("id")
    var id: Int? = null

    @ApiModelProperty("商品类型名称")
    var name: String? = null


    fun getVo(table: TProductType): ProductTypeVo {
        table.let {
            val data = ProductTypeVo()
            data.id = it.id
            data.name = it.name
            return data
        }
    }

    fun getVoList(table: List<TProductType>): List<ProductTypeVo> {
        table.let {
            val list = mutableListOf<ProductTypeVo>()
            it.forEach {
                val data = ProductTypeVo()
                data.id = it.id
                data.name = it.name
                list.add(data)
            }
            return list
        }
    }

}